import { syncAction } from '../base/syncAction'

const sksGlobalOwnerName='sksGlobal'

//updateMultipleBitColumn


export function updateProcessStatusInGlobal({urlAlias="updateProcessStatusInGlobal",successFunction,errorFunction,tableName,ownerId,attrValue,setbBitAttrValue,clrBitAttrValue}){

    const domain={
        tableName: tableName,
        ownerId: ownerId,
        globalUpdateBitColumnMOList:[
            {
                attrName: 'process_status',
                attrValue: attrValue,
                setbBitAttrValue: setbBitAttrValue,
                clrBitAttrValue: clrBitAttrValue,
            }
        ]
    }
    const saList=[{
        alias: 'updateMultipleBitColumn',
        ownerName: sksGlobalOwnerName,
        beanName: 'updateMultipleBitColumn',
        domain: domain
    }]
    syncAction(saList,urlAlias).then(response=>{
        if(successFunction){
            successFunction(response)
        }
    }).then(error=>{
        errorFunction()
    })
    return
}

export function updateSingleBitColumnDomain({successFunction,errorFunction,tableName,attrName,ownerId,attrValue,setbBitAttrValue,clrBitAttrValue}){
    const domain={
        ownerName: tableName,
        ownerId: ownerId,
        globalUpdateBitColumnMOList:[
            {
                attrName: attrName,
                attrValue: attrValue,
                setbBitAttrValue: setbBitAttrValue,
                clrBitAttrValue: clrBitAttrValue,
            }
        ]
    }
    syncAction(domain).then(response=>{
        if(successFunction){
            successFunction(response)
        }
    }).then(error=>{
        errorFunction()
    })
    return
}

export function updateMultipleBitColumnSksGlobalSyncAction({domain,alias="updateInventoryReturn"}){
    const sa= {
        alias: alias,
        ownerName: inventoryReturnOwnerName,
        beanName: "updateMultipleBitColumn",
        domain: domain
    }
    return sa

}
